<template>
    <div>
        <label>
            <span>ID</span>
            <input v-model="id">
        </label>
        <label>
            <span>名字</span>
            <input v-model="name">
        </label>
        <label>
            <span>年纪</span>
            <input v-model="age">
        </label>
        <label>
        <span>电子邮箱</span>
        <input v-model="email">
    </label>
        <button @click="submitform">提交</button>
    </div>
</template>

<script>
    import Axios from 'axios'
    export default {
        name: "Adduser",
        data(){
            return {
                id:'',
                name:'',
                age:'',
                email:''
            }
        },
        methods: {
            submitform:function () {
                var user ={
                     id:this.id,
                     name:this.name,
                     age:this.age,
                     email:this.email
                };
                window.console.log(JSON.stringify(user));
                Axios({
                    url: 'http://localhost/parkrun/adduser',
                    method: 'post',
                    data:user
                }).then((res) =>{
                    window.console.log(res)
                })
            }
        }
    }
</script>

<style scoped>

</style>
